/* ========================================================================= */
/* ------------------------------------------------------------------------- */
/*!
  \file			mw.h
  \date			Dec 2012
  \author		TNick

  \brief		Contains the definition for MW class


*//*


 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Please read COPYING and README files in root folder
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
/* ------------------------------------------------------------------------- */
/* ========================================================================= */
#ifndef __MW_INC__
#define __MW_INC__
//
//
//
//
/*  INCLUDES    ------------------------------------------------------------ */

#include    <QMainWindow>
#include	<memtrack.h>
#include	"ui_mw.h"


#include	<cpg/actions/actionshost.h>
#include	<cpg/actions/view/viewimpl.h>
#include	<cpg/actions/mdi/mdiimpl.h>
#include	<cpg/actions/insert/insertimpl.h>
#include	<cpg/actions/help/helpimpl.h>
#include	<cpg/actions/file/fileimpl.h>
#include	<cpg/actions/edit/editimpl.h>


/*  INCLUDES    ============================================================ */
//
//
//
//
/*  DEFINITIONS    --------------------------------------------------------- */

namespace		Ui				{

class MW;

}	/* namespace Ui */

/*  DEFINITIONS    ========================================================= */
//
//
//
//
/*  CLASS    --------------------------------------------------------------- */


namespace	Gui		{

/**
*	@brief	Form that represents main window for the application
*/
class MW : public QMainWindow, public ActionsHost		{
	Q_OBJECT
	BBM_TRACK( MW )

	//
	//
	//
	//
	/*  DEFINITIONS    ----------------------------------------------------- */

	/*  DEFINITIONS    ===================================================== */
	//
	//
	//
	//
	/*  DATA    ------------------------------------------------------------ */

private:

	/**
	*	@brief	GUI components embedded here
	*/
	Ui::MW							ui;


	/**
	*	@brief	ui infrastructure related to apparence
	*/
	ViewImpl						viewimpl_;


	/**
	*	@brief	ui infrastructure related to multiple document interface
	*/
	MdiImpl							mdiimpl_;


	/**
	*	@brief	ui infrastructure related to help
	*/
	HelpImpl						helpimpl_;


	/**
	*	@brief	ui infrastructure related to files and application
	*/
	FileImpl						fileimpl_;


	/**
	*	@brief	ui infrastructure related to inserting elements
	*/
	InsertImpl						insertimpl_;


	/**
	*	@brief	ui infrastructure related to editing
	*/
	EditImpl						editimpl_;


	/**
	*	@brief	current directory when browsing for files
	*/
	QString							s_dir_crt_;


	/*  DATA    ============================================================ */
	//
	//
	//
	//
	/*  FUNCTIONS    ------------------------------------------------------- */


public:


	/**
	*	@brief	constructor
	*/
	explicit			MW		( QWidget *parent = 0 );


	/**
	*	@brief	destructor
	*/
	~MW		(void);


protected:


	/**
	*	@brief	dynamic change of language
	*/
	void				changeEvent					( QEvent *e );


	/**
	*	@brief	dynamic change of language
	*/
	void				closeEvent					( QCloseEvent *e );







	/* ******************************************************************* */
	/** @name 	ActionsHost Interface methods                              */
	/* ******************************************************************* */
	///@{


public:


	/**
	*	@brief	widget to be used as parent for the ui components
	*/
	QWidget *			uiParentWidget		( void )
	{ return this; }


	/**
	*	@brief	the target editor
	*/
	EditorBase *		crtEditor			( void )
	{
		return mdiimpl_.crtEditor();
	}


	/**
	*	@brief	current directory for open/save
	*/
	QString &			crtDirectory		( void )
	{
		return s_dir_crt_;
	}


	///@}
	/* ******************************************************************* */


private slots:


	/**
	*	@brief	fired when the current editor changes
	*/
	void				activeEditorChanged		( EditorBase * ed );


	/**
	*	@brief	fired when selection in a current editor changes
	*
	*	Every editor is connected to this slot within editorCreated()
	*/
	void				editorSelChanged		( void );


	/**
	*	@brief	fired when a new editor is about to become visible
	*/
	void				editorCreated			( EditorBase * ed );


	/**
	*	@brief	fired when file in an editor is saved to disk
	*/
	void				editorSaved				( EditorBase * ed );


	/**
	*	@brief	fired when preferences dialog should be shown
	*/
	void				showPrefs				( void );


	/**
	*	@brief	a request to open an external resource
	*/
	void				openLinkUReq			( const QUrl & url );


	/**
	*	@brief	contextual menu
	*/
	void				contextMenu				( const QPoint & pt );


	/**
	*	@brief	informed when we begin the process of exporting content
	*/
	void				exportStarted				( void );


	/**
	*	@brief	informed that a file was created/opened as an output file
	*/
	void				outputFileOpened			( const QString & s );


	/**
	*	@brief	informed when we end the process of exporting content
	*/
	void				exportEnded					( bool b_result );


	/**
	*	@brief	we are asked to present the menu for the status bar
	*/
	void				statusMenuReq				( const QPoint & pt );


public slots:


	/**
	*	@brief	request to load a file into the editor
	*/
	bool				openFile				( const QString & s_file );


	/**
	*	@brief	log message
	*/
	void				logMessage				( const QString & s );


signals:


	/**
	*	@brief	fired when cursor moves in active editor or active editor changes
	*/
	void				editorCursorMoved		(
			EditorBase *				ed,
			bool						b_with_sel
			);


	/*  FUNCTIONS    ======================================================= */
	//
	//
	//
	//

};	/*	class MW	*/

/*  CLASS    =============================================================== */
//
//
//
//

}	//	namespace	Gui

#endif // __MW_INC__
/* ------------------------------------------------------------------------- */
/* ========================================================================= */
